package com.grape.basic2022.base;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;

/**
 * @Author pan_jin
 * @Description: $
 * @Date: 2022/8/23 14:23
 * @Version: 1.0.0
 * @Slogan: 梦想还是要有的万一实现了呢
 */
public class Main {
    public static void main(String[] args) throws IntrospectionException {
//        for (String arg : args) {
//            if ("-version".equals(arg)){
//                System.out.println("版本号1.0");
//                break;
//            }
//        }

        BeanInfo beanInfo = Introspector.getBeanInfo(User.class);
        PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
        for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
            System.out.println("propertyDescriptor.getWriteMethod() = " + propertyDescriptor.getReadMethod());
            System.out.println("propertyDescriptor.getWriteMethod() = " + propertyDescriptor.getWriteMethod());
            System.out.println("propertyDescriptor.getName() = " + propertyDescriptor.getName());
        }
    }
}
